package com.ruoyi.common.core.domain.model;

import java.util.Collection;

import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

import com.alibaba.fastjson.annotation.JSONField;
import com.ruoyi.common.core.domain.entity.UserInfo;

import lombok.Data;
/**
 * C端用户表
 * ClassName: AppUser <br/> 
 * Function: TODO ADD FUNCTION. <br/> 
 * date: 2022年3月29日 上午11:26:16 <br/> 
 * 
 * @author tomcat
 * @version  
 * @since JDK 1.8
 */
@Data
public class AppUser implements UserDetails{
	  private static final long serialVersionUID = 1L;
	  
	  private String userId;
	    /**
	     * 用户唯一标识
	     */
	  private String token;
	  
	  private UserInfo user;
	  
	  
	  public AppUser(UserInfo user,String userId) {
		  this.userId = userId;
	       
	        this.user = user;
	       
	  }
	  

	@Override
	public Collection<? extends GrantedAuthority> getAuthorities() {
		// TODO Auto-generated method stub
		return null;
	}

	@JSONField(serialize = false)
	@Override
	public boolean isAccountNonExpired() {
		// TODO Auto-generated method stub
		return true;
	}
	
	@JSONField(serialize = false)
	@Override
	public boolean isAccountNonLocked() {
		// TODO Auto-generated method stub
		return true;
	}

	@JSONField(serialize = false)
	@Override
	public boolean isCredentialsNonExpired() {
		// TODO Auto-generated method stub
		return true;
	}

	@JSONField(serialize = false)
	@Override
	public boolean isEnabled() {
		// TODO Auto-generated method stub
		return true;
	}

	@JSONField(serialize = false)
	@Override
	public String getPassword() {
		// TODO Auto-generated method stub
		return user.getPassword();
	}

	@Override
	public String getUsername() {
		// TODO Auto-generated method stub
		return user.getUserName();
	}
	  
}
